//
//  BDAccountManagerModel.h
//  BeidouMall
//
//  Created by qie on 16/3/31.
//  Copyright © 2016年 qie. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface BDAccountManagerModel : NSObject

@property (nonatomic,assign) NSString *userId;
@property (nonatomic,copy) NSString *userName;// 用户名
@property (nonatomic,copy) NSString *password;
@property (nonatomic,copy) NSString *phone;
@property (nonatomic,copy) NSString *email;
@property (nonatomic,copy) NSString *authorization;
@property (nonatomic,copy) NSString *tempAuthorization;//临时
//定位
@property (nonatomic,assign)double latitude;
@property (nonatomic,assign)double longitude;
@property (nonatomic,copy) NSString *adcode;
@property (nonatomic,assign) NSInteger cityCode;
@property (nonatomic,copy) NSString *inBoundary;

@property (nonatomic,assign,getter=isLogin) BOOL login;

+ (BDAccountManagerModel *)shareInstance;

- (BOOL)saveNormarlUserInformation: (NSDictionary *) information;

/**
 * @brief 用户登录
 *
 * @param  username 用户名.
 * @param  password 密码.
 * @param  userType 用户类型.
 * @param  completionHandler  请求回调函数.
 *
 * @return Void
 */
- (void)loginWithUrl:(NSString *) urlPath
            username:(NSString *)username
            password:(NSString *)password
            userType:(NSString *)userType
   completionHandler:(void (^)(NSError *error))completionHandler;

/**
 * @brief 用户验证码登录
 *
 * @param  username 用户名.
 * @param  verifyCode 验证码.
 * @param  userType 用户类型.
 * @param  flag 是否是找回密码调用.
 * @param  completionHandler  请求回调函数.
 *
 * @return Void
 */
- (void)verifyLoginWithUrl:(NSString *) urlPath
            username:(NSString *)username
            verifyCode:(NSString *)verifyCode
            userType:(NSString *)userType
            flag:(NSString *)flag
   completionHandler:(void (^)(NSDictionary *results, NSError *error))completionHandler;

/**
 * @brief 用户退出登录
 *
 * @return Void
 */
- (void)logoutWithUrl:(NSString *) urlPath
    completionHandler:(void (^)(NSError *error))completionHandler;
/**
 * @brief 查询用户是否注册
 *
 * @param  phone 手机号码.
 * @param  userType 用户类型.
 * @param  completionHandler  请求回调函数.
 *
 * @return Void
 */

- (void)checkUserWithUrl:(NSString *) urlPath
                       phone:(NSString *)phone
                        userType:(NSString *)userType
           completionHandler:(void (^)(NSError *error))completionHandler;

/**
 * @brief 获取验证码
 *
 * @param  phone 手机号码.
 * @param  completionHandler  请求回调函数.
 *
 * @return Void
 */
- (void)getVerifyCodeWithUrl:(NSString *) urlPath
             completionHandler:(void (^)(NSError *error))completionHandler;

/**
 * @brief 用户注册
 *
 * @param  username 用户名.
 * @param  phone 手机号码.
 * @param  password 密码.
 * @param  verifyCode 验证码.
 * @param  completionHandler  请求回调函数.
 *
 * @return Void
 */
- (void)registerWithWithUrl:(NSString *) urlPath
                   username:(NSString *) username
                       phone:(NSString *) phone
                    password:(NSString *) password
                  verifyCode:(NSString *) verifyCode
                   userType:(NSString *) userType
           completionHandler:(void (^)(NSError *error)) completionHandler;

/**
 * @brief 用户修改密码
 *
 * @param  userId 用户名.
 * @param  password 密码.
 * @param  completionHandler  请求回调函数.
 *
 * @return Void
*/

- (void)modifyPwdWIthUrl:(NSString *)urlPath
                userId:(NSString *) userId
                   password:(NSString *) password
        completionHandler:(void (^)(NSError *error)) completionHandler;

@end
